package com.slt.android.cheackfrontback;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;


public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    public static final String TAG = "cheackTest";
    Button btn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        btn = (Button) findViewById(R.id.btn);
        btn.setOnClickListener(this);
        Log.e(TAG , "---->1111--->onCreate");
    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.e(TAG , "---->1111--->onStart");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.e(TAG , "---->1111--->onResume");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.e(TAG , "---->1111--->onPause");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.e(TAG , "---->1111--->onStop");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.e(TAG , "---->1111--->onDestroy");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.e(TAG , "---->1111--->onRestart");
    }


    @Override
    public void onClick(View v) {
        Intent intent = new Intent(this , SecondActivity.class);
        startActivityForResult(intent , 1024);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        Toast.makeText(this , "onActivityResult进来了" , Toast.LENGTH_SHORT).show();
        switch (requestCode){
            case 1024:
                Toast.makeText(this , "switch进来了" , Toast.LENGTH_SHORT).show();
                break;
            default:
                break;
        }
    }
}
